/*
******************
* author: 马丰彦
* date: 2019
* function: 管理cookie
******************
*/

import Cookies from 'js-cookie'

const TokenKey = 'boss_token'
const UserIdKey = 'boss_user'
const UserAvatarKey = 'boss_avatar'
const PlatformKey = 'boss_platform'
const RoleKey = 'boss_role'
const UserName = 'userName'
const UserRole = 'userRole'
// token
export function getToken() {
  return Cookies.get(TokenKey)
}

export function setToken(token) {
  return Cookies.set(TokenKey, token)
}

export function removeToken() {
  return Cookies.remove(TokenKey)
}

// userid
export function getUserId() {
  return Cookies.get(UserIdKey)
}

export function setUserId(userId) {
  return Cookies.set(UserIdKey, userId)
}

// avatar
export function getUserAvatar() {
  return Cookies.get(UserAvatarKey)
}

export function setUserAvatar(userAvatar) {
  return Cookies.set(UserAvatarKey, userAvatar)
}

// PlatformKey
export function getPlatformKey() {
  return Cookies.get(PlatformKey)
}
export function setPlatformKey(userPlatform) {
  return Cookies.set(PlatformKey, userPlatform)
}

// RoleKey
export function getRoleKey() {
  return Cookies.get(RoleKey)
}
export function setRoleKey(userRole) {
  return Cookies.set(RoleKey, userRole)
}

export function getUser() {
  return Cookies.get(UserName)
}

export function setUser(token) {
  return Cookies.set(UserName, token)
}

export function removeUser() {
  return Cookies.remove(UserName)
}

export function getRole() {
  return Cookies.get(UserRole)
}

export function setRole(token) {
  return Cookies.set(UserRole, token)
}

export function removeRole() {
  return Cookies.remove(UserRole)
}
